package com.example.flutter_android_tv

import android.os.Bundle
import android.os.PersistableBundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity: FlutterActivity() {

    private val methodChannelName = "com.flutter.methodChannel"
    private lateinit var channel: MethodChannel;

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        print("开始22222222222222222")
        channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, methodChannelName);
        channel.setMethodCallHandler{ call, result ->
            print("开始33333333333333")
            if (call.method == "com.flutter.checkDevice"){
                result.success(DeviceInfoUtil.isTV(context));
            }else{
                result.notImplemented()
            }
        }
    }

}
